package database.demo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DataBaseWrapperExtras extends SQLiteOpenHelper {

	public static final String EXTRAS = "Extras";
	public static final String EXTRAS_ID = "_id";
	public static final String EXTRAS_NAME = "_name";
	public static final String EXTRAS_DESCRIPTION = "_description";
	public static final String EXTRAS_MATURE_PRICE = "_mature";
	public static final String EXTRAS_CHILD_PRICE = "_child";
		
	private static final String DATABASE_NAME = "Extras.db";
	private static final int DATABASE_VERSION = 1;

	// creation SQLite statement
	private static final String DATABASE_CREATE = "create table " + EXTRAS
			+ "(" + EXTRAS_ID + " text primary key, "
			+ EXTRAS_NAME + " text not null, "
			+ EXTRAS_DESCRIPTION + " text, "
			+ EXTRAS_MATURE_PRICE + " double, "
			+ EXTRAS_CHILD_PRICE + " double, "
			+ ");";

	public DataBaseWrapperExtras(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		//db.execSQL("DROP TABLE IF EXISTS " + EXTRAS);
		db.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// you should do some logging in here
		// ..
		db.execSQL("DROP TABLE IF EXISTS " + EXTRAS);
		onCreate(db);
	}
	
	
}